﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CafeNhiepAnh.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        static List<int> lst = new List<int>();
        

        public string GetStep(string id)
        {
            if(lst.Where(m=>m==Int32.Parse(id)).Count()>0)
                return "";
            if (lst.Count == 0)
                lst.Add(Int32.Parse(id));
            var lstTemp = lst.Where(m => m > Int32.Parse(id)).ToArray();
            if (lstTemp.Count() == 0)
                lst.Add(Int32.Parse(id));
            return id;
        }

        public string Sync(string id)
        {
            var lstTemp = lst.Where(m => m > Int32.Parse(id)).ToArray();
            if (lstTemp.Count() == 0)
                return "";
            return lstTemp[0].ToString();
        }

        public ActionResult TestSocket()
        {
            return View();
        }
    }
}
